package com.sumer.function;

import java.util.function.Consumer;

/**
 * 消费型接口测试
 */
public class ConsumerTest {

    public static void main(String[] args) {
        Consumer<String> consumer1 = new Consumer<String>() {
            @Override
            public void accept(String string) {
                System.out.println(string);
            }
        };
        // lambda 简化
        Consumer<String> consumer2 = string -> System.out.println(string);
        consumer1.accept("测试");
        consumer2.accept("测试");
    }
}
